package com.yaowk.web.mall.clothing.controller;

import com.yaowk.api.common.PageReq;
import com.yaowk.api.common.PageResp;
import com.yaowk.api.mall.clothing.model.Surveyor;
import com.yaowk.api.mall.clothing.service.ISurveyorService;
import com.yaowk.api.mall.clothing.web.SurveyorModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/mall/clothing/surveyor")
@Api(tags = "量体师控制器")
public class SurveyorController {

    @Autowired
    private ISurveyorService surveyorService;

    @GetMapping
    @ApiOperation("量体师列表")
    public PageResp<SurveyorModel> list(String keyword, PageReq pageReq) {
        PageResp<SurveyorModel> page = surveyorService.findAllOfWeb(keyword, pageReq);
        return page;
    }

    @PostMapping
    @ApiOperation("保存量体师")
    public void save(Surveyor surveyor) {
        surveyorService.save(surveyor);
    }

    @GetMapping("/{id}")
    @ApiOperation("查看详情")
    public SurveyorModel find(@PathVariable Integer id) {
        SurveyorModel surveyor = surveyorService.findDetailById(id);
        return surveyor;
    }
}
